package com.example.speedment;

import com.company.cm.SpeedmentMysqlDemoApplication;
import com.company.cm.SpeedmentMysqlDemoApplicationBuilder;
import com.company.cm.cm.cm.weather_info.WeatherInfo;
import com.company.cm.cm.cm.weather_info.WeatherInfoManager;

import java.math.BigDecimal;
import java.util.List;

import static java.util.stream.Collectors.toList;

public class Main {

    public static void main(final String... args) {
        SpeedmentMysqlDemoApplication app = new SpeedmentMysqlDemoApplicationBuilder()
                .withUsername("root")
                .withPassword("root")
                .build();

        // You are ready to go!
        WeatherInfoManager weathers = app.getOrThrow(WeatherInfoManager.class);
        List<WeatherInfo> weatherInfoList = weathers.stream()
                .filter(WeatherInfo.TEMPERATURE.greaterOrEqual(new BigDecimal(20)))
                .collect(toList());
        weatherInfoList.forEach(System.out::println);
        app.close();
    }
}